package com.clear.facade.moreDatabase;

/**
 * 门面类
 */
public class DataBaseFacade {
    private DataBase mysqlDatabase;
    private DataBase oracleDatabase;

    public DataBaseFacade() {
        mysqlDatabase = new MySQLDatabase();
        oracleDatabase = new OracleDatabase();
    }

    public void executeSQL(String sql, String databaseType) {
        if (("MySQL").equalsIgnoreCase(databaseType)) {
            mysqlDatabase.execute(sql);
        } else if (("Oracle").equalsIgnoreCase(databaseType)) {
            oracleDatabase.execute(sql);
        } else {
            throw new IllegalArgumentException("Unknown database type: " + databaseType);
        }
    }
}
